﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
using System.Xml;

namespace Tracy.CoreLib.Data
{

    public partial class RssModel : XmlModel_AutoParseFunctions, IXmlModel
    {
        

        private RssModel.RssChannel channel;

        public RssModel.RssChannel Channel
        {
            get { return channel; }
        }

        #region 构造函数
        public RssModel(XmlNode node) : base(node) { }
        public RssModel(string xml) : base(xml) { }
        public RssModel() : base() { }
        #endregion

        public string XmlNodeName
        {
            get
            {
                return Constants.CONST_TAG_RSS;
            }
        }

        //public RssModel.RssChannel CreateChannel(XmlNode node)
        //{
        //    RssModel.RssChannel newChannel = new RssModel.RssChannel(node);
        //    channel = newChannel;
        //    return newChannel;
        //}


        protected override void PreParseXml(XmlNode node)
        {
            channel = new RssModel.RssChannel(SelectNode(node, Constants.CONST_TAG_CHANNEL, true));  
        }

        protected override void PostGenerateXml(XmlDocument doc, XmlNode newNode)
        {
            newNode.AppendChild(Channel.ToXmlNode(doc));
        }
    }
}
